package com.tcoiss.log.service.impl;

import com.tcoiss.common.component.api.model.WorkLog;
import com.tcoiss.log.mapper.WorkLogMapper;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.tcoiss.log.service.IWorkExecuteLogService;

import java.util.List;

/**
 * 作业日志Service业务层处理
 *
 * @author zw
 * @date 2021-05-07
 */
@Service
public class WorkLogServiceImpl extends ServiceImpl<WorkLogMapper, WorkLog> implements IWorkExecuteLogService {

    @Override
    public List<WorkLog> queryList(WorkLog workExecuteLog) {
        LambdaQueryWrapper<WorkLog> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(workExecuteLog.getWorkName())){
            lqw.like(WorkLog::getWorkName ,workExecuteLog.getWorkName());
        }
        if (StringUtils.isNotBlank(workExecuteLog.getExecuteNumber())){
            lqw.eq(WorkLog::getExecuteNumber ,workExecuteLog.getExecuteNumber());
        }
        if (workExecuteLog.getWorkType() != null){
            lqw.eq(WorkLog::getWorkType ,workExecuteLog.getWorkType());
        }
        if (workExecuteLog.getWorkStatus() != null){
            lqw.eq(WorkLog::getWorkStatus ,workExecuteLog.getWorkStatus());
        }
        if (workExecuteLog.getLogTime() != null){
            lqw.eq(WorkLog::getLogTime ,workExecuteLog.getLogTime());
        }
        return this.list(lqw);
    }
}
